//
//  ItemVC5HeadView.m
//  喜马拉雅FM
//
//  Created by dllo on 16/2/25.
//  Copyright © 2016年 lanou.com. All rights reserved.
//

#import "ItemVC5HeadView.h"

@interface ItemVC5HeadView ()

@property (nonatomic, retain) UIVisualEffectView *visualView;

@end

@implementation ItemVC5HeadView

- (instancetype)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];
    if (self) {

        [self createSubViews];
        
    }
    return self;
}
- (void)createSubViews {
    
#pragma mark - 等级毛玻璃效果
    
    UIImageView *imageForBackGround = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"denglu.jpg"]];
    imageForBackGround.frame = self.bounds;
    imageForBackGround.userInteractionEnabled = YES;
    [self addSubview:imageForBackGround];
    
    /** 创建UIBlurEffect类的对象blur, 参数这里使用的是黑色*/
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:2];
    
    /** 创建UIVisualEffectView的对象visualView, 以blur为参数. */
    self.visualView = [[UIVisualEffectView alloc] initWithEffect:blur];
    
    /** 将visualView的大小等于头视图的大小. (visualView的大小可以自行设定, 它的大小决定了显示毛玻璃效果区域的大小.) */
    self.visualView.frame = self.bounds;
    // 透明度
    self.visualView.alpha = 1;
    /** 将visualView添加到blurImageView上. */
    [imageForBackGround addSubview:self.visualView];
    
    /** 对visualView进行内存管理. */
    [self.visualView release];
    [imageForBackGround release];
    
    UIImageView *loginBackGroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"denglu.jpg"]];
    loginBackGroundView.userInteractionEnabled = YES;
    loginBackGroundView.center = self.center;
    loginBackGroundView.layer.cornerRadius = 55;
    loginBackGroundView.layer.masksToBounds = YES;
    [self.visualView addSubview:loginBackGroundView];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleLogin)];
    [loginBackGroundView addGestureRecognizer:tap];
    [tap release];
    
    
    
//    UIButton *buttonForLogin = [UIButton buttonWithType:UIButtonTypeSystem];
//    buttonForLogin.frame = CGRectMake(0, 0, 50, 30);
//    [buttonForLogin setTitle:@"登 录" forState:UIControlStateNormal];
//    [buttonForLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    buttonForLogin.center = CGPointMake(self.center.x , self.center.y + 75);
//    [self.visualView addSubview:buttonForLogin];
//    [buttonForLogin addTarget:self action:@selector(handleLogin) forControlEvents:UIControlEventTouchUpInside];

}

- (void)handleLogin {

    NSLog(@"dddddd");

}




@end
